﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonExtensions.ObjectExtensions;
using CommonExtensions.StringExtensions;
using DBMigrator.Core.DbObjects.Data.Select.From;

namespace DBMigrator.Core.DbObjects.Data.Select
{
    public class SelectCountOptions : ISelectCountOptions
    {
        public Type SqlGenerationType
        {
            get { return typeof(ISelectCountOptions); }
        }

        public string ColumnName { get; private set; }
        public IBeginFrom BeginFrom { get; private set; }
        
        public SelectCountOptions(IBeginFrom beginFrom)
        {
            if(beginFrom.IsNull())
                throw new ArgumentNullException("beginFrom");

            BeginFrom = beginFrom;
        }
        
        public IBeginFrom CountOf(string columnName)
        {
            if(columnName.IsBlank())
                throw new ArgumentNullException("columnName");

            ColumnName = columnName;

            return BeginFrom;
        }
    }
}
